package com.yzjs.localhost.controller.tDataPersistenceBeforce;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.yzjs.common.enumeration.RequestMethod;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import com.yzjs.common.base.entity.PageInfo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yzjs.localhost.entity.tDataPersistenceBeforce.TDataPersistenceBeforceEntity;
import com.yzjs.localhost.service.tDataPersistenceBeforce.TDataPersistenceBeforceService;




/**
 * 入库之前参数存储
 *
 * @author yuqiumin
 * @email sunlightcs@gmail.com
 * @date 2021-08-24 17:00:37
 */
@Api(tags = "入库之前参数存储")
@RestController
@RequestMapping("tDataPersistenceBeforce")
public class TDataPersistenceBeforceController {
    @Autowired
    private TDataPersistenceBeforceService tDataPersistenceBeforceService;




    /**
     * 信息
     */
    @ApiOperation(value="信息" ,httpMethod =RequestMethod.GET )
    @RequestMapping("/info")
    public TDataPersistenceBeforceEntity info( @RequestParam(required = true)   Integer id){
        TDataPersistenceBeforceEntity  query = new TDataPersistenceBeforceEntity();
        query.setId(id);
        TDataPersistenceBeforceEntity tDataPersistenceBeforce = tDataPersistenceBeforceService.findOne(query);
        return  tDataPersistenceBeforce ;
    }
    /**
    * 列表查询
    * @return
    */
    @ApiOperation(value="列表查询" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/list")
    public List<TDataPersistenceBeforceEntity> List( @RequestBody TDataPersistenceBeforceEntity tDataPersistenceBeforce) {
        List<TDataPersistenceBeforceEntity> tDataPersistenceBeforces = tDataPersistenceBeforceService.findList(tDataPersistenceBeforce);
        return tDataPersistenceBeforces;
    }


    /**
     * 分页查询
     * @param tDataPersistenceBeforce
     * @return
     */
    @ApiOperation(value="分页查询" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/listPage")
    public PageInfo<TDataPersistenceBeforceEntity> listPage(@RequestBody TDataPersistenceBeforceEntity tDataPersistenceBeforce) {
        List<TDataPersistenceBeforceEntity> tDataPersistenceBeforces  = tDataPersistenceBeforceService.findList(tDataPersistenceBeforce);
        return new PageInfo<>(tDataPersistenceBeforces ,tDataPersistenceBeforce);
    }


    /**
     * 保存
     */
    @ApiOperation(value="保存" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/save")
    public TDataPersistenceBeforceEntity save(@RequestBody TDataPersistenceBeforceEntity tDataPersistenceBeforce){
		tDataPersistenceBeforceService.insert(tDataPersistenceBeforce);
        return tDataPersistenceBeforce;
    }

    /**
     * 修改
     */
    @ApiOperation(value="修改" ,httpMethod =RequestMethod.POST )
    @RequestMapping("/update")
    public TDataPersistenceBeforceEntity update(@RequestBody TDataPersistenceBeforceEntity tDataPersistenceBeforce){
		tDataPersistenceBeforceService.update(tDataPersistenceBeforce);
        return tDataPersistenceBeforce;
    }

    /**
     * 删除
     */
    @ApiOperation(value="删除" ,httpMethod =RequestMethod.DELETE )
    @RequestMapping("/delete")
    public TDataPersistenceBeforceEntity  delete( @RequestParam(required = true)  Integer id){
        TDataPersistenceBeforceEntity  delete  = new TDataPersistenceBeforceEntity();
        delete.setId(id);
        tDataPersistenceBeforceService.delete(delete);
        return delete;
    }

}
